package com.zhongkai.controller;

import com.zhongkai.app.service.SellQueryService;
import com.zhongkai.model.utils.ZhongkaiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *销售查询
 **/
@Controller
public class SellQueryController {

    @Autowired
    private SellQueryService sellQueryService;

    /**
     * 列表
     * @param page 页码
     * @param rows 条数
     */
    @RequestMapping(value = "/sell_query/list", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult listSellQuery(@RequestParam(defaultValue = "0")Integer page, @RequestParam(defaultValue = "0")Integer rows
    ) {


        ZhongkaiResult result = sellQueryService.listSellQuery(page,rows);

        return result;
    }



    /**
     * 销售记录查询
     *
     * @param page 页数
     * @param rows 每页数据条数
     * @param name 操作人员姓名
     * @param time 时间
     */
    @RequestMapping(value = "/sell_query/list_q", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult listQuery(@RequestParam(defaultValue = "0")Integer page, @RequestParam(defaultValue = "0")Integer rows,
                                    String name,@RequestParam(defaultValue = "0")Long time
    ) {


        ZhongkaiResult result = sellQueryService.listQuery(page,rows,name,time);

        return result;
    }



    /**
     * 销售柱状图
     */
    @RequestMapping(value = "/sell_query/analyze", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult analyze(@RequestParam(defaultValue = "0")Integer page, @RequestParam(defaultValue = "0")Integer rows,
                                    String name,@RequestParam(defaultValue = "0")Long time
    ) {


        ZhongkaiResult result = sellQueryService.analyze();

        return result;
    }


    /**
     * 销售饼状图
     */
    @RequestMapping(value = "/sell_query/cake", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult cake(@RequestParam(defaultValue = "0")Integer page, @RequestParam(defaultValue = "0")Integer rows,
                                  String name,@RequestParam(defaultValue = "0")Long time
    ) {


        ZhongkaiResult result = sellQueryService.cake();

        return result;
    }
}
